/**
 * 
 */
package ru.opedge.notifical.util.transliteration;

import java.util.HashMap;
import java.util.Map;

/**
 * @author opedge
 * 
 */
public class CyrillicLatinTransliterator extends Transliterator
{
	/*
	 * (non-Javadoc)
	 * 
	 * @see transliteration.Transliterator#getReplace(char)
	 */
	@Override
	public String getReplace(final char c)
	{
		final String result = table.get(c);
		if (result == null)
			return new Character(c).toString();
		return result;
	}

	public static final String ID = "Cyrillic-Latin";

	private static Map<Character, String> table = new HashMap<Character, String>();
	static
	{
		table.put('а', "a");
		table.put('б', "b");
		table.put('в', "v");
		table.put('г', "g");
		table.put('д', "d");
		table.put('е', "e");
		table.put('ё', "e");
		table.put('ж', "zh");
		table.put('з', "z");
		table.put('и', "i");
		table.put('к', "k");
		table.put('л', "l");
		table.put('м', "m");
		table.put('н', "n");
		table.put('о', "o");
		table.put('п', "p");
		table.put('р', "r");
		table.put('с', "s");
		table.put('т', "t");
		table.put('у', "u");
		table.put('ф', "f");
		table.put('х', "h");
		table.put('ц', "c");
		table.put('ч', "ch");
		table.put('ш', "sh");
		table.put('щ', "sch");
		table.put('ъ', "'");
		table.put('ы', "y");
		table.put('ь', "'");
		table.put('э', "e");
		table.put('ю', "yu");
		table.put('я', "ya");
	
		Map<Character, String> tableUpper = new HashMap<Character, String>();
		for (char c : table.keySet())
		{
			char key = Character.toUpperCase(c);
			String value = table.get(c).toUpperCase();
			tableUpper.put(key, value);
		}
		
		table.putAll(tableUpper);
	}
}
